package me.sealer.ssm.constant;

/**
 * 功能描述： $ ErrorCode
 * code 共六位，前两位代表模块名，后四位代表具体异常
 *
 * @author sealer
 * @email 1178884049@qq.com
 * @date 2019年11月27日 10时40分04秒
 */
public enum ErrorCodeConstant {
    // 01 ssm

    // 02 user
    USER_USER_NOT_EXISTS("010001", "user.not.exists", "用户不存在"),
    USER_USER_ALREADY_EXISTS("010002", "user.already.exists", "用户已存在"),
    USER_PASSWORD_CONFIRM_WRONG("010003", "user.password.confirm.wrong", "两次输入的密码不一致，请确认后操作！"),
    USER_REGISTER_FAIL("010004", "user.register.fail", "注册失败！"),
    USER_LOGIN_FAIL("010005", "user.login.fail", "用户名或密码错误！"),
    USER_LOGIN_PASSWORD_WRONG("010006", "user.login.password.wrong", "登录密码错误！"),
    USER_PASSWORD_NEW_OLD_SAME("010007", "user.password.new.old.same", "输入的新密码与旧密码相同，请确认后操作！"),
    USER_USERNAME_CANNOT_BE_PURE_NUMBER("010008", "user.username.cannot.pure.number", "用户名不能是纯数字"),
    USER_USERNAME_CANNOT_CONTAINS_AT("010009", "user.username.cannot.contains.email", "用户名不能存在邮件标识符@"),
    USER_LOGIN_TYPE_ERROR("010010", "user.login.type.error", "登录类型有误"),
    // 03 china area

    // 04 short url

    // 05 file
    FILE_FILE_NOT_EXISTS("050001", "file.not.exists", "文件不存在"),

    // 06 role
    ROLE_MODIFY_SUCCESS("060000", "role.modify.success", "角色修改成功"),
    ROLE_ROLE_NOT_EXISTS("060001", "role.not.exists", "角色不存在"),
    ROLE_LIST_NULL("060002", "role.list.null", "角色列表为空"),
    ROLE_ROLE_BE_USED_BY_USER("060003", "role.be.used.by.user", "角色被用户关联， 无法删除"),
    ROLE_ROLE_EXISTS("060004", "role.exists", "角色已存在"),

    // 07 permission
    PERMISSION_LIST_NULL("070001", "permission.list.null", "权限列表为空"),
    PERMISSION_MODIFY_SUCCESS("070002", "permission.modify.success", "权限修改成功"),
    PERMISSION_NOT_EXISTS("070003", "permission.not.exists", "权限不存在"),
    PERMISSION_ALREADY_USED("070004", "permission.already.used", "权限已被占用，无法删除"),

    // 08 token
    TOKEN_IMAGE_TOKEN_ERROR("080001", "token.image.error", "图形验证码错误"),
    TOKEN_PHONE_TOKEN_ERROR("080002", "token.phone.error", "短信验证码错误"),
    TOKEN_PHONE_NUMBER_IS_NULL("080003", "token.phone.number.null", "生成短信验证码的手机号为空"),
    TOKEN_RESUBMIT_TOKEN_ERROR("080004", "token.resubmit.error", "请勿重复提交"),

    // 09 sms
    SMS_SEND_SUCCESS("090000", "sms.send.success", "短信验证码发送成功"),
    SMS_SEND_ERROR("090001", "sms.send.error", "短信验证码发送失败"),

    // 10 菜单menu
    MENU_LEVEL_INVALID("100001", "menu.level.invalid", "菜单层级不合法"),
    MENU_PARENT_MENU_NOT_HAVING_SUBS("100002", "menu.parent.menu.not.having.subs", "该父级菜单不存在子菜单"),
    MENU_NOT_EXISTS("100003", "menu.not.exists", "该菜单不存在"),

    // 11 SQL异常
    SQL_CONSTRAINT_EXCEPTION("110001", "sql.constraint.exception", "违反sql完整性约束"),

    // 00 99 系统全局返回码
    SYSTEM_SUCCESS("000000", "success", "成功"),
    SYSTEM_NOT_AUTHORIZED("990001", "system.not.authorized", "您没有权限执行此操作！"),
    SYSTEM_NOT_NULL("990002", "system.not.null", "不能为空"),
    SYSTEM_TIME_OUT("990003", "system.timeout", "超时"),
    SYSTEM_EXIT_SAFELY("990004", "system.exit.safely", "安全退出系统"),
    SYSTEM_NOT_AUTHENTICATED("990005", "system.not.authenticated", "请登录后再执行此操作！"),
    SYSTEM_METHOD_REFLECT_CALL_ERROR("990006", "system.method.reflect.call.error", "方法调用异常！"),

    SYSTEM_UNKNOWN_ERROR("999999", "system.unknown.error", "系统未知错误");
    private String returnCode;
    private String message;
    private String description;

    private ErrorCodeConstant(String returnCode, String message, String description) {
        this.returnCode = returnCode;
        this.message = message;
        this.description = description;
    }

    public String getReturnCode() {
        return returnCode;
    }

    public String getMessage() {
        return message;
    }

    public String getDescription() {
        return description;
    }
}
